namespace Xmef.Engine.Internal
{
    using System;
    using System.Reflection;
    using Xmef.Interfaces;
    using Xmef.Library;

    [Serializable]
    internal class PluginTypeContainer : PluginIdentity, IPluginTypeContainerInternal, IPluginIdentity
    {
        public T Create<T>(Assembly assembly)
        {
            return (T) assembly.CreateInstance(typeof(T).FullName);
        }

        public Assembly LoadAssembly(string assemblyFile)
        {
            try
            {
                return Assembly.LoadFrom(assemblyFile);
            }
            catch (Exception ex)             
            {
                LogHelper.WriteErrorSync(ex);
            }
            return null;
        }
    }
}

